import java.security.PublicKey;
import java.util.ArrayList;

/**
 * Created by IntelliJ IDEA.
 * User: torstein
 * Date: 3/20/12
 * Time: 12:58 PM
 * To change this template use File | Settings | File Templates.
 */
public class Relations {
    private ArrayList<Relation> relations;
    private String quiverName;
    public void Relation(String quiverName) {
        this.quiverName = quiverName;
    }

    public ArrayList<Relation> getRelations() {
        return relations;
    }

    public void setRelations(ArrayList<Relation> relations) {
        this.relations = relations;
    }

    public void remove (Relation r) {
        for (Relation s : relations) {
            if (r == s) {
                relations.remove(s);
            }
        }
    }

    public void add (Relation r) {
        relations.add(r);
    }
    
    public String toGAPCode () {
        String relationString = "";
        int i = 0;
        for (Relation r : relations) {
                if (i != 0) {
                    relationString += ",";
                }
                relationString += r.toString();
                i++;
        }
        return String.format("%sRels := [%s]", quiverName, relationString);
    }
    
    public static Relations fromGAPCode() {
        return new Relations();
    }
}
